<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<!-- http://127.0.0.1:8080/company/web/reg.jsp -->
<%@ include file="/web/header.jsp" %>
<title>系统注册</title>
</head>
<body>
<fieldset class="layui-elem-field" style='margin:20px;padding:20px'>
  <legend>系统注册</legend>
  <div class="layui-field-box">
   	<form class="layui-form layui-form-pane" action="">
	  <div class="layui-form-item">
	    <label class="layui-form-label">账号</label>
	    <div class="layui-input-inline">
	      <input type="text" name="code" required  lay-verify="required" placeholder="请输入帐号" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">密码框</label>
	    <div class="layui-input-inline">
	      <input type="password" name="psd" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">姓名</label>
	    <div class="layui-input-inline">
	      <input type="text" name="name" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">
	      <img src='/company/VerifyCodeServlet' onclick="this.src='/company/VerifyCodeServlet?'+Math.random();"/>
		</label>
	    <div class="layui-input-inline">
	      <input type="text" name="yzm" required  lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <div class="layui-input-inline">
		  <input type="button" class="layui-btn" lay-submit lay-filter="reg" value="注册">		   
	      <input type="reset" class="layui-btn layui-btn-primary" value="重置">
	    </div>
	    <input type="button" class="layui-btn" value="跳转登录" onclick="toJsp('/web/login.jsp')">
	  </div>
	  <input type="hidden" name="action" value="reg"  />
	</form>
  </div>
</fieldset>
<script type="text/javascript">
// function toJspLogin(){
// // 	location.href=base.app+"/web/login.jsp"
// 	toJsp('/web/login.jsp');
// }

// 	var form=layui.form;
// 	var $=layui.jquery;
// 	var layer=layui.layer;
// 	 form.on('submit(reg)',function(data){//给按钮加监听，执行方法
// 		 console.log(data.field);//在页面的开发者控制台输出
// 	  $.ajax({
// 		    url:"/company/employee",
// 			type:"post",
// 			data:data.field ,
// 			dataType:"text",
// 			success:function(data){
// 				console.log(data)
// 				if("F"==data){
// 					layer.msg("验证码错误")
// 				}else if("E"==data){
// 					layer.msg("账号已存在")
// 				}else if("1"==data){
// 					layer.msg("注册成功")
// 				}else{
// 					layer.msg("注册失败");
// 				}
// 			}
// 		});  
// 	 })

	formOn("/employee",'submit(reg)',"text",function(data){
// 	console.log(data)
		if("F"==data){
			layer.msg("验证码错误")
		}else if("E"==data){
			layer.msg("账号已存在")
		}else if("1"==data){
			layer.msg("注册成功")
		}else{
			layer.msg("注册失败");
		}
})

</script>
</body>
</html>